﻿using IntelligentAgriculture.Contracts.Interface;
using IntelligentAgriculture.WebAPI.Application.Command.PurchaseFormModelCommand;
using MediatR;

namespace IntelligentAgriculture.WebAPI.Application.CommandHandler.PurchaseFormModelCommandHandler
{
	/// <summary>
	/// 养只档案删除
	/// </summary>
	public class DelPurchaseFormsCommandHandler : IRequestHandler<DelPurchaseFormsCommand, Results<int>>
	{
		/// <summary>
		/// 构造函数
		/// </summary>
		private readonly IPurchaseFormModelService _purchaseFormModelService;
		public DelPurchaseFormsCommandHandler(IPurchaseFormModelService purchaseFormModelService)
		{
			_purchaseFormModelService = purchaseFormModelService;
		}
		/// <summary>
		/// 养只档案删除
		/// </summary>
		/// <param name="request"></param>
		/// <param name="cancellationToken"></param>
		/// <returns></returns>
		/// <exception cref="NotImplementedException"></exception>
		public async Task<Results<int>> Handle(DelPurchaseFormsCommand request, CancellationToken cancellationToken)
		{
			var ids = await _purchaseFormModelService.DelPurchaseForms(request.ids);
			return Results<int>.DataResult(ids);
		}
	}
}
